#ifndef __DEVICE_DISK_H_
#define __DEVICE_DISK_H_

#include <string>
#include <set>
#include <functional>

namespace device {
  // if have callback, it will call every line output.
  bool pcall(const std::string &cmd, std::function<bool(const std::string &line)> callback = nullptr, int max_line_len = 256);

  enum class escan_stat {
    start, runing, end
  };
  // call pcall, and output to callbacl by filter
  bool pscan(const std::string &cmd, const std::string &begin, const std::string &end
    , std::function<bool(const std::string &line, escan_stat stat)> callback);

  std::string trim(const std::string &str, const std::string &flag = " ");

  struct sdisk_info {
    std::string dev;
    std::string vendor;
    std::string product;
    std::string version;
    std::string serial;
  };

  bool scan_disk(std::set<std::string> &disks);
  bool disk_info(const std::string &dev, sdisk_info *si);

  bool scan_memory(std::set<std::string> &info);
  bool scan_bios(std::set<std::string> &info);
  bool scan_board(std::set<std::string> &info);
  bool scan_system(std::set<std::string> &info);
  bool scan_chassis(std::set<std::string> &info);
  bool scan_connector(std::set<std::string> &info);

  bool scan_diaplay(std::set<std::string> &info);
  bool scan_network(std::set<std::string> &info);
}

#endif